// reading a text file
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
using namespace std;

double* getAngleData () {
	int size = 640;
	double* angle = new double[size];

  string line;
  ifstream myfile ("./matlabbeam/angle.txt");
  if (myfile.is_open())
  {
	int i = 0;
    while ( myfile.good() )
    {
      getline (myfile,line);
      //cout << line << endl;
      const char *p;
      p=line.c_str();
      angle[i] = atof(p);
      i++;
    }
    myfile.close();
  }

  else cout << "Unable to open file";

  return angle;
}

double* getBeamData () {
	int size = 640;
	double* angle = new double[size];

  string line;
  ifstream myfile ("./matlabbeam/beam.txt");
  if (myfile.is_open())
  {
	int i = 0;
    while ( myfile.good() )
    {
      getline (myfile,line);
      //cout << line << endl;
      const char *p;
      p=line.c_str();
      angle[i] = atof(p);
      i++;
    }
    myfile.close();
  }

  else cout << "Unable to open file";

  return angle;
}

double* getTangentData () {
	int size = 640;
	double* angle = new double[size];

  string line;
  ifstream myfile ("./matlabbeam/tangent.txt");
  if (myfile.is_open())
  {
	int i = 0;
    while ( myfile.good() )
    {
      getline (myfile,line);
      //cout << line << endl;
      const char *p;
      p=line.c_str();
      angle[i] = atof(p);
      i++;
    }
    myfile.close();
  }

  else cout << "Unable to open file";

  return angle;
}
